package com.ruoyi.edu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.edu.mapper.EduUserMapper;
import com.ruoyi.edu.domain.EduUser;
import com.ruoyi.edu.service.IEduUserService;

import java.util.List;
import java.util.Map;

/**
 * 微信用户Service业务层处理
 *
 * @author niruichen
 * @date 2020-12-19
 */
@Service
public class EduUserServiceImpl extends ServiceImpl<EduUserMapper, EduUser> implements IEduUserService {

    @Override
    public List<EduUser> queryList(EduUser eduUser) {
        LambdaQueryWrapper<EduUser> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(eduUser.getOpenid())){
            lqw.eq(EduUser::getOpenid ,eduUser.getOpenid());
        }
        if (StringUtils.isNotBlank(eduUser.getNickname())){
            lqw.like(EduUser::getNickname ,eduUser.getNickname());
        }
        if (eduUser.getSex() != null){
            lqw.eq(EduUser::getSex ,eduUser.getSex());
        }
        if (StringUtils.isNotBlank(eduUser.getAvatar())){
            lqw.eq(EduUser::getAvatar ,eduUser.getAvatar());
        }
        if (StringUtils.isNotBlank(eduUser.getCity())){
            lqw.eq(EduUser::getCity ,eduUser.getCity());
        }
        if (StringUtils.isNotBlank(eduUser.getSign())){
            lqw.eq(EduUser::getSign ,eduUser.getSign());
        }
        if (eduUser.getDisabled() != null){
            lqw.eq(EduUser::getDisabled ,eduUser.getDisabled());
        }
        if (eduUser.getLastLoginTime() != null){
            lqw.eq(EduUser::getLastLoginTime ,eduUser.getLastLoginTime());
        }
        if (eduUser.getDeleted() != null){
            lqw.eq(EduUser::getDeleted ,eduUser.getDeleted());
        }
        return this.list(lqw);
    }
}
